#include <QThread>
#include "qlogger.hpp"

namespace {
    QLogger logger = QLoggerEngine::logger("Core");
}

class MyThread : public QThread
{
    protected:
        void run () {
            logInfo(logger, QString().sprintf("threadHandle=%p - Run Thread", this));
            int i = 0;
            while (i<5) {
                logDebug(logger, QString().sprintf("running top : %p", this));
                i++;
                msleep(100);
            }
        }    
};

int main (int argc, char *argv[])
{
    QLoggerEngine::configureConsoleAppender(127, stdout, "%d - <%l> - {%c} - %f:%i -- %m%n"); 
    QLoggerEngine::configureFileAppender(127, "/dev/null", "%r - <%l> - {%c} -- %m%n"); 

    MyThread thread1, thread2;

    logInfo(logger, "starting");

    thread1.start();
    thread2.start();
    
    thread1.wait();
    thread2.wait();

    logInfo(logger, "terminate");
    return 0;
}

